<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%  
	String path = request.getContextPath();  
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="/bsc/static/common/bootstrap/js/bootstrap-3.3.7-dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/bsc/static/common/bootstrap/js/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css">
<script src="/bsc/static/js/jquery-3.1.1.js"></script>
<script src="/bsc/static/common/bootstrap/js/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>

</head>
<body>
		<center>
		<form action="<%=basePath %>bagupdate" method="post" enctype="multipart/form-data">
			<table class="table table-bordered">
				<input type="hidden" name="bag_id" id="bag_id" value="${bag.bag_id }"/>
				<tr>
					<td>礼包名称：</td>
					<td>
						<input type="text" name="bag_name" value="${bag.bag_name}">
					</td>
					<td>状态：</td>
					<td>
						<select name="status">
								<option value="1" ${bag.status=='1'?'selected':'' }>在售</option>
								<option value="2" ${bag.status=='2'?'selected':'' }>下架</option>
							</select>
					</td>
				</tr>
				<tr>
					<td>列表图片：</td>
					<td>
							<input type="hidden" value="${bag.cover_photo }" name="photoname1">
							<input type="file"   name="file" />
							<div style="width:100px; height:100px; border-radius:50%; overflow:hidden;">
								<img width="100px" height="100px" src="/bsc${bag.cover_photo }" id="cover_photo"/>
							</div> 
					</td>
					<td>封面图片：</td>
					<td>
						 <input type="hidden" value="${bag.cover_big_photo }" name="photoname2">
							<input type="file" name="file" />
							<div style="width:100px; height:100px; border-radius:50%; overflow:hidden;">
								<img width="100px" height="100px" src="/bsc${bag.cover_big_photo }" id="cover_big_photo"/>
							</div>
					</td>
				</tr>
				<tr>
					<td>护理项目：</td>
					<td></td>
					<td></td>
					<td></td>
				</tr>
				<tr>
					<td>礼包价格：</td>
					<td>
						<input type="text" name="bag_total_price" value="${bag.bag_total_price }"> 元
					</td>
					<td>开卡数量：</td>
					<td>
						<input type="text" id="zhi1" name="open_card_num" value="${bag.open_card_num }"/>
						<input type="button" id="jian1" value="-"/>	
						<input type="button" id="jia1" value="+"/>
					</td>
				</tr>
				<tr>
					<td>每次最少购买量：</td>
					<td>
						<input type="text" id="zhi2" name="min_buy_num" value="${bag.min_buy_num }"/>
						<input type="button" id="jian2" value="-"/>	
						<input type="button" id="jia2" value="+"/>
					</td>
					<td>每次最大购买量：</td>
					<td>
						<input type="text" id="zhi3" name="max_buy_num" value="${bag.max_buy_num }"/>
						<input type="button" id="jian3" value="-"/>	
						<input type="button" id="jia3" value="+"/>
					</td>
				</tr>
				<tr>
					<td>允许购买次数：</td>
					<td>
						<input type="text" id="zhi4" name="buy_count" value="${bag.buy_count }"/>
						<input type="button" id="jian4" value="-"/>	
						<input type="button" id="jia4" value="+"/>
					</td>
					<td>过期时间：</td>
					<td>
						<input type="text" id="zhi5" name="overdue_time" value="${bag.overdue_time }"/>
						<input type="button" id="jian5" value="-"/>	
						<input type="button" id="jia5" value="+"/>天
					</td>
				</tr>
				<tr>
					<td>上架时间：</td>
					<td>
						<input type="date" name="putaway_time" value="${bag.putaway_time }"/>
					</td>
					<td>下架时间：</td>
					<td>
						<input type="date" name="soldout_time" value="${bag.soldout_time }"/>
					</td>
				</tr>
				<tr>
					<td>排序号：</td>
					<td>
						<input type="text" id="zhi6" name="sort_no" value="${bag.sort_no }"/>
						<input type="button" id="jian6" value="-"/>	
						<input type="button" id="jia6" value="+"/>
					</td>
					<td>礼包介绍：</td>
					<td>
						<textarea rows="" cols="" name="bag_introduce">
						
						</textarea>
					</td>
				</tr>
				<tr align="center">
					<td colspan="4">
						<input type="submit" value="提交"/>
						<input type="button" value="关闭" onclick="custom_close()"/>
					</td>
				</tr>
			</table>
		</form>
	</center>
</body>
</html>
<script type="text/javascript">

function custom_close(){
    if(confirm("您确定要关闭本页吗？")){
        window.opener=null;
        window.location.href = "<%=basePath%>bagselect"; 
        window.close();
    }
    else{
    }
}

$(function(){
	var zhi1 = parseInt($("#zhi1").val());
	
	$("#zhi1").val(zhi1);
	$("#jian1").on("click",function(){
		if(zhi1>1){
			zhi1 = zhi1 - 1;
		}
		$("#zhi1").val(zhi1);
	});
	
	$("#jia1").on("click",function(){
		
			zhi1 = zhi1 + 1;
		
		$("#zhi1").val(zhi1);
	});
	
	
	var zhi2 = parseInt($("#zhi2").val());
	
	$("#zhi2").val(zhi2);
	$("#jian2").on("click",function(){
		if(zhi2>1){
			zhi2 = zhi2 - 1;
		}
		$("#zhi2").val(zhi2);
	});
	
	$("#jia2").on("click",function(){
		
			zhi2 = zhi2 + 1;
		
		$("#zhi2").val(zhi2);
	});
	
	var zhi3 = parseInt($("#zhi3").val());
	
	$("#zhi3").val(zhi3);
	$("#jian3").on("click",function(){
		if(zhi3>1){
			zhi3 = zhi3 - 1;
		}
		$("#zhi3").val(zhi3);
	});
	
	$("#jia3").on("click",function(){
		
			zhi3 = zhi3 + 1;
		
		$("#zhi3").val(zhi3);
	});
	
	var zhi4 = parseInt($("#zhi4").val());
	
	$("#zhi4").val(zhi4);
	$("#jian4").on("click",function(){
		if(zhi4>1){
			zhi4 = zhi4 - 1;
		}
		$("#zhi4").val(zhi4);
	});
	
	$("#jia4").on("click",function(){
		
			zhi4 = zhi4 + 1;
		
		$("#zhi4").val(zhi4);
	});
	
	var zhi5 = parseInt($("#zhi5").val());
	
	$("#zhi5").val(zhi5);
	$("#jian5").on("click",function(){
		if(zhi5>1){
			zhi5 = zhi5 - 1;
		}
		$("#zhi5").val(zhi5);
	});
	
	$("#jia5").on("click",function(){
		
			zhi5 = zhi5 + 1;
		
		$("#zhi5").val(zhi5);
	});
	
	var zhi6 = parseInt($("#zhi6").val());
	
	$("#zhi6").val(zhi6);
	$("#jian6").on("click",function(){
		if(zhi6>1){
			zhi6 = zhi6 - 1;
		}
		$("#zhi6").val(zhi6);
	});
	
	$("#jia6").on("click",function(){
		
			zhi6 = zhi6 + 1;
		
		$("#zhi6").val(zhi6);
	});
	
});
</script>